home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 December / Australian PC User - December 2003 (CD2).iso / software / apps / files / dwmx2k4.exe / Disk1 / data1.cab / Configuration_En / Objects / Text / Abbr.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  1.7 KB  |  66 lines

  1. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved
  2.  
  3. var helpDoc = MM.HELP_objAbbreviation;
  4.  
  5. //---------------   GLOBAL VARIABLES   ---------------
  6.  
  7. var TEXT_FULL;
  8. var TEXT_LANG;
  9. var gDialogShown = false;
  10.  
  11. //---------------     API FUNCTIONS    ---------------
  12.  
  13. function isDOMRequired() { 
  14.     // Return false, indicating that this object is available in code view.
  15.     return false;
  16. }
  17.  
  18. function onOK(){
  19.   if (!gDialogShown){
  20.       TEXT_FULL = document.theForm.fullText;
  21.       TEXT_LANG = document.theForm.langAtt;
  22.       TEXT_FULL.focus();  
  23.   }
  24.     var okToInsert = true;
  25.     if (TEXT_FULL == ""){
  26.         alert(MSG_NEED_FULL_TEXT);
  27.         okToInsert = false;
  28.         TEXT_FULL.focus();
  29.     }
  30.     return okToInsert;
  31. }
  32.  
  33. function objectTag(){
  34.   if (!gDialogShown){
  35.       TEXT_FULL = document.theForm.fullText;
  36.       TEXT_LANG = document.theForm.langAtt;
  37.       TEXT_FULL.focus();  
  38.   }
  39.     var lang = "";
  40.   var upCaseTag = (dw.getPreferenceString("Source Format", "Tags Upper Case", "") == 'TRUE');
  41.   var upCaseAtt = (dw.getPreferenceString("Source Format", "Attrs Upper Case", "") == 'TRUE');
  42.   
  43.     if (TEXT_LANG.value != ""){
  44.         lang = ((upCaseAtt)?' LANG="':' lang="') + TEXT_LANG.value + '"';
  45.     }
  46.     
  47.     // Manually wrap tags around selection.
  48.   var dom = dw.getDocumentDOM();
  49.   var beginWrap = (upCaseTag)?'<ABBR':'<abbr';
  50.   beginWrap += ((upCaseAtt)?' TITLE="':' title="') + TEXT_FULL.value + '"' + lang + '>';
  51.   var endWrap = (upCaseTag)?'</ABBR>':'</abbr>';
  52.  
  53.     dom.source.wrapSelection(beginWrap,endWrap);
  54.  
  55.   // Just return -- don't do anything else.
  56.     return;
  57. }
  58.  
  59. //---------------    LOCAL FUNCTIONS   ---------------
  60. function initUI() {
  61.   gDialogShown = true;
  62.     TEXT_FULL = document.theForm.fullText;
  63.     TEXT_LANG = document.theForm.langAtt;
  64.     TEXT_FULL.focus();
  65. }
  66.